package com.happyclub.lbjcontroller;

import com.happyclub.lbj.service.IShopCar;
import com.happyclub.pojo.TbShopcar;
import com.happyclub.utils.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 高欢
 * @description
 * @date 2019/4/12
 */
@RestController
@RequestMapping("/shopCar")
public class ShopCarController {
    @Autowired
    IShopCar iShopCar;

    @RequestMapping(value = "/saveProToShopCar",method = RequestMethod.POST)
    public JsonResult saveProToShopCar(@RequestBody TbShopcar shopcar){
        return iShopCar.saveProToShopCar(shopcar);
    }

    @RequestMapping(value = "/delShopCar/{id}",method = RequestMethod.DELETE)
    public JsonResult delShopCar(@PathVariable String id){
        return iShopCar.delProFromShopCar(id);
    }

    //查看购物车商品
    @RequestMapping(value = "/findAllProFromShopCar/{userId}",method = RequestMethod.GET)
    public JsonResult findAllProFromShopCar(@PathVariable String userId){
        return iShopCar.findProFromShopCarByUserId(userId);
    }
}
